<template>
	<div style="width=200px">
		<el-form ref="form" :rules="rules" :model="form" label-width="120px">


		<!-- 	<el-form-item label="编号" prop="contentNumber">
				<el-input v-model="form.contentNumber"></el-input>
			</el-form-item> -->
			<el-form-item label="名称" prop="contentName">
				<el-input v-model="form.contentName"></el-input>
			</el-form-item>
			<el-form-item label="价格" prop="contentPrice">
				<el-input v-model="form.contentPrice"></el-input>
			</el-form-item>
			<el-form-item label="描述" prop="contentDescribe">
				<el-input v-model="form.contentDescribe"></el-input>
			</el-form-item>
			<el-form-item label="增值" prop="contentAppreciation">
				<el-input v-model="form.contentAppreciation"></el-input>
			</el-form-item>
			<el-form-item label="状态" prop="contentStatus">
				 <el-select v-model="form.contentStatus" placeholder="请选择">
				    <el-option
				      v-for="item in options"
				      :key="item.value"
				      :label="item.label"
				      :value="item.label">
					<!-- <el-input v-model="form.status"></el-input> -->
					  
				    </el-option>
				  </el-select>
			</el-form-item>
			<el-form-item label="备注" prop="contentremarks">
				<el-input v-model="form.contentremarks"></el-input>
			</el-form-item>

			<el-form-item>
				<el-button type="primary" plain @click="save">保存数据</el-button>

			</el-form-item>
		</el-form>
		
	</div>
</template>

<script>
	export default {
		name: 'NursingContentEdit',
		components: {

		},
		props: [
			'show',
			'editid'
		],
		data() {
			return {
				form: {
					contentId: '',
					// contentnumber: '',
					contentname: '',
					contentprice: '',
					eventTime: '',
					contentdescribe: '',
					contentappreciation: '',
					contentstatus: '',
					contentremarks: ''
				},
				options: [{
				        value: '选项1',
				        label: '未启用'
				      }, {
				        value: '选项2',
				        label: '启用'
				      }], 

				rules: {

					contentname: [{
							required: true,
							message: '类别名不能为空',
							trigger: 'blur'
						},
						{
							min: 1,
							max: 100,
							message: '长度在 1 到 100 个字符',
							trigger: 'blur'
						}
					]
				},

				nursing_content: [],
				depts: [],
			}
		},
		
		
		created() {
			if (this.editid) {
				this.show = true;
				this.$axios.get(
					'nursingContent/getById',
					response => {
						this.form = response.obj
						
					}, 
					{id: this.editid })
			}
		},
		methods: {
			save() {
				this.axios.get('/nursingContent/add', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}

				}, this.form, '保存成功');
			},
			update(){
				this.axios.get('/nursingContent/update', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}
				
				}, this.id,this.status,'更新成功');
				
			}
			
		}

	}
</script>

<style>
</style>
